<template>
  <div>
    御剑乘风来,除魔天地间!===app
    <Ref ref="ref"></Ref>
    <h1 ref="h1" v-if="flag">这里是h1</h1>
    <button @click="change">切换显示隐藏</button>
    <input type="text" ref="input" />
  </div>
</template>
<script>
import Ref from "./05zuoye/two-ref/ref.vue";
export default {
  components: {
    Ref,
  },
  data() {
    return {
      flag: true,
    };
  },
  created() {},
  mounted() {
    this.$refs.input.focus();
    this.$refs.h1.innerHTML = this.$refs.ref.reff;
  },
  computed: {},
  methods: {
    change() {
      this.flag = !this.flag;
      if (!this.flag) {
        console.log(this.$refs.h1);
      } else {
        this.$nextTick(() => {
          console.log(this.$refs.h1);
        });
      }
    },
  },
};
</script>
<style lang='less'  scoped>
</style>
